package zuoye2;
/*通过实现java.lang.Runnable接口的方式创建一个新线程，
 *要求main线程打印100次”main”，新线程打印50次“new”*/
public class RunnableDemo implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i <50 ; i++) {
            System.out.println("第"+(i+1)+"遍new");
        }
    }

    public static void main(String[] args) {
        RunnableDemo me=new RunnableDemo();
        Thread thread=new Thread(me);
        thread.start();
        for (int i = 0; i < 100; i++) {
            System.out.println("第"+(i+1)+"遍main");
        }
    }
}
